import allure
from appium.webdriver.common.appiumby import AppiumBy

from base.wework_app import Wework


class MemberInfoPage(Wework):
    """
    人员信息页面
    """
    # 右上角设置按钮
    _setting_btn = (AppiumBy.XPATH,
                    "//*[@text='个人信息']/ancestor::android.widget.RelativeLayout/android.widget.LinearLayout[2]//android.widget.TextView")
    # 编辑成员按钮
    _edit_member_btn = (AppiumBy.XPATH,"//*[@text='编辑成员']")

    @allure.step("点击右上角设置按钮，进入个人信息设置")
    def click_setting_btn(self):
        """
        点击右上角设置按钮，进入个人信息设置
        :return:
        """
        self.find_ele(self._setting_btn).click()
        return self

    @allure.step("点击编辑成员，进入编辑成员页面")
    def goto_edit_member_page(self):
        """
        点击编辑成员，进入编辑成员页面
        :return: 编辑成员 page
        """
        from page.edit_member_page import EditMemberPage

        self.find_ele(self._edit_member_btn).click()

        return EditMemberPage(self.driver)

